﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AzurePlugin.WizardImpl
{
    public partial class frmProgress : Form
    {
        public frmProgress()
        {
            InitializeComponent();
        }

        public void ShowProgress(Action func)
        {
            _func = func;

            ShowDialog();
        }

        private void frmProgress_Shown(object sender, EventArgs e)
        {
            timer.Enabled = true;
        }

        private Action _func;

        private void timer_Tick(object sender, EventArgs e)
        {
            timer.Enabled = false;

            Cursor curCursor = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;

            _func();

            Cursor.Current = curCursor;
            this.Close();
        }
    }
}
